/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bo;

import beans.AccountBean;
import java.util.ArrayList;
import mapper.AccountMapper;

/**
 *
 * @author Haomaru
 */
public class AccountBO {
    public boolean login(String id, String pass) throws Exception {
		AccountMapper mapper = null;
		boolean found = false;
		try {
			mapper = new AccountMapper();
			found = mapper.login(id, pass);
		}
		catch (Exception e) {
			throw e;
		}
		
		return found;
	}
	
	public void insertNewUser(AccountBean newUser) throws Exception {
		AccountMapper mapper = null;
		try {
			mapper = new AccountMapper();
			mapper.insertNewUser(newUser);
		}
		catch (Exception e) {
			throw e;
		}
	}
	
	public AccountBean getUserInformation(String id) throws Exception {
		AccountMapper mapper = null;
		try {
			mapper = new AccountMapper();
			return mapper.getUserInformation(id);
		}
		catch (Exception e) {
			throw e;
		}
	}
	
	public ArrayList<AccountBean> listUser() throws Exception {
		AccountMapper mapper = null;
		try {
			mapper = new AccountMapper();
			return mapper.listUser();
		}
		catch (Exception e) {
			throw e;
		}
	}
}
